// Copyright 2018 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package com.google.firebase.dynamiclinks.internal;

import android.net.Uri;
import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
import com.google.android.gms.common.internal.safeparcel.SafeParcelReader;
import com.google.android.gms.common.internal.safeparcel.SafeParcelWriter;

// Autogenerated, do not edit
public class DynamicLinkDataCreator implements Parcelable.Creator<DynamicLinkData> {
  public static final int CONTENT_DESCRIPTION = 0;

  public DynamicLinkDataCreator() {}

  public DynamicLinkData createFromParcel(Parcel parcel) {
    int end = SafeParcelReader.validateObjectHeader(parcel);

    String _local_safe_0a1b_dynamicLink = null;

    String _local_safe_0a1b_deepLink = null;

    int _local_safe_0a1b_minVersion = 0;

    long _local_safe_0a1b_clickTimestamp = 0L;

    Bundle _local_safe_0a1b_extensionBundle = null;

    Uri _local_safe_0a1b_redirectUrl = null;

    while (parcel.dataPosition() < end) {
      int header = SafeParcelReader.readHeader(parcel);
      switch (SafeParcelReader.getFieldId(header)) {
        case 1:
          _local_safe_0a1b_dynamicLink = SafeParcelReader.createString(parcel, header);

          break;

        case 2:
          _local_safe_0a1b_deepLink = SafeParcelReader.createString(parcel, header);

          break;

        case 3:
          _local_safe_0a1b_minVersion = SafeParcelReader.readInt(parcel, header);

          break;

        case 4:
          _local_safe_0a1b_clickTimestamp = SafeParcelReader.readLong(parcel, header);

          break;

        case 5:
          _local_safe_0a1b_extensionBundle = SafeParcelReader.createBundle(parcel, header);

          break;

        case 6:
          _local_safe_0a1b_redirectUrl =
              (Uri) SafeParcelReader.createParcelable(parcel, header, Uri.CREATOR);

          break;

        default:
          SafeParcelReader.skipUnknownField(parcel, header);
      }
    }

    SafeParcelReader.ensureAtEnd(parcel, end);

    DynamicLinkData obj =
        new DynamicLinkData(
            _local_safe_0a1b_dynamicLink,
            _local_safe_0a1b_deepLink,
            _local_safe_0a1b_minVersion,
            _local_safe_0a1b_clickTimestamp,
            _local_safe_0a1b_extensionBundle,
            _local_safe_0a1b_redirectUrl);

    return obj;
  }

  public DynamicLinkData[] newArray(int size) {
    return new DynamicLinkData[size];
  }

  static void writeToParcel(DynamicLinkData obj, Parcel parcel, int flags) {
    int myStart = SafeParcelWriter.beginObjectHeader(parcel);

    SafeParcelWriter.writeString(parcel, 1, obj.getDynamicLink(), false);

    SafeParcelWriter.writeString(parcel, 2, obj.getDeepLink(), false);

    SafeParcelWriter.writeInt(parcel, 3, obj.getMinVersion());

    SafeParcelWriter.writeLong(parcel, 4, obj.getClickTimestamp());

    SafeParcelWriter.writeBundle(parcel, 5, obj.getExtensionBundle(), false);

    SafeParcelWriter.writeParcelable(parcel, 6, obj.getRedirectUrl(), flags, false);

    SafeParcelWriter.finishObjectHeader(parcel, myStart);
  }
}
